import 'package:auto_route/annotations.dart';
import 'package:base/application.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_sliders/sliders.dart';

import '../../common/net/user_req.dart';


@RoutePage()
class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<StatefulWidget> createState() => _HomeState();
}

class _HomeState extends State<HomePage> {

  @override
  void initState() {
    super.initState();

  }

  double _value = 40.0;

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: const Text("Swap face"),
      ),
      body: Center(
        child: SfSlider(
          min: 0.0,
          max: 100.0,
          value: _value,
          interval: 20,  // 每20个单位显示一个标签
          showLabels: true,  // 启用标签显示
          showTicks: true,   // 显示刻度
          inactiveColor: Colors.red,
          activeColor: Colors.green,
          thumbIcon: Container(width: 20, height: 20, color: Colors.purpleAccent,),
          // 自定义标签格式化
          labelFormatterCallback: (dynamic actualValue, String formattedText) {
            // 将数值转换为百分比格式
            print(actualValue);
            return '${actualValue.toInt()}%';
          },
          onChanged: (dynamic newValue) {
            setState(() {
              _value = newValue;
            });
          },
        ),
      ),
    );
  }

  @override
  void dispose() {
    print("home dispose");
    super.dispose();
  }
}
